From 75092d295b554b5e39c41b839810854bed1c5a9e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 10 May 2007 20:19:38 +0000 Subject: [PATCH] Unparent the old image before overwriting priv->image. (#437281, Jochen 2007-05-10 Matthias Clasen * gtk/gtkbutton.c (gtk_button_set_image): Unparent the old image before overwriting priv->image. (#437281, Jochen Baier) svn path=/trunk/; revision=17816 --- ChangeLog | 5 +++++ gtk/gtkbutton.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f17b93b3b9..2e9e110a79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-10 Matthias Clasen + + * gtk/gtkbutton.c (gtk_button_set_image): Unparent the old + image before overwriting priv->image. (#437281, Jochen Baier) + 2007-05-10 Matthias Clasen * gtk/gtkscrolledwindow.c (gtk_scrolled_window_scroll_child): diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 2b0ad37c00..c2729c0432 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -733,7 +733,7 @@ gtk_button_construct_child (GtkButton *button) image = g_object_ref (priv->image); if (image->parent) gtk_container_remove (GTK_CONTAINER (image->parent), image); - + priv->image = NULL; } @@ -1970,6 +1970,9 @@ gtk_button_set_image (GtkButton *button, priv = GTK_BUTTON_GET_PRIVATE (button); + if (priv->image && priv->image->parent) + gtk_container_remove (GTK_CONTAINER (priv->image->parent), priv->image); + priv->image = image; priv->image_is_stock = (image == NULL); -- 2.30.2